package com.glsc.ngateway.common.base.repo.mysql.cmdb;

import com.glsc.ngateway.common.base.domain.mysql.cmdb.CmdbDict;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CmdbDictRepository extends JpaRepository<CmdbDict, Integer>, JpaSpecificationExecutor<CmdbDict> {
    List<CmdbDict> findAllByDictIdIn(List<Long> id);
    CmdbDict findByDictNameAndDictDeleted(String dictName, Integer dictDeleted);

    CmdbDict findByDictCodeAndDictDeleted(String dictCode, Integer dictDeleted);

    List<CmdbDict> findAllByDictCodeInAndDictDeleted(List<String> dictCode,Integer dictDeleted);

//    @Query(value = "select * from cmdb_dict where dict_deleted=0 and ( (dict_code in :productDictCodeList) OR (:productDictCodeListStr IS NULL) )", nativeQuery = true)
//    List<CmdbDict> findByCodeList(@Param("productDictCodeList") List<String> productDictCodeList, @Param("productDictCodeListStr") String productDictCodeListStr);
}

